Skip to content

Say what is wrong with a pull request number, and test the head ref (#307) - #327

Merged
adrpo merged 1 commit into
OpenModelica:masterfrom
adrpo:fix-pull-request-checkout
Aug 24, 2026
Merged

Say what is wrong with a pull request number, and test the head ref (#307)#327
adrpo merged 1 commit into
OpenModelica:masterfrom
adrpo:fix-pull-request-checkout

Conversation

@adrpo

@adrpo adrpo commented Aug 24, 2026

Copy link
Copy Markdown
Member

Follows #324. Build 11442 asked for 16360, which is not a pull request but an
issue - issues and pull requests share one numbering on GitHub, so an issue
number reaches the job looking exactly like a pull request number.

+ git fetch --force https://github.com/OpenModelica/OpenModelica.git refs/pull/16360/merge
fatal: couldn't find remote ref refs/pull/16360/merge
Could not fetch refs/pull/16360/merge: either there is no such pull request, or
GitHub cannot merge it into its base branch.

Two things were wrong with that, neither of them the fetch:

  • it came after the clone, the fetch and the reset of the OpenModelica
    repository, so a number that could have been rejected in a second cost
    minutes;
  • it offered two possibilities and committed to neither, when the answer is
    knowable: git ls-remote refs/pull/16360/* returns nothing at all, so there is
    no such pull request, full stop.

What changes

The stage asks first. One git ls-remote, before anything is cloned or
built:

OpenModelica/OpenModelica has no pull request 16360. Issues and pull requests
share one numbering there, so check that 16360 is not the number of an issue.

The checkout separates the two cases. GitHub only has refs/pull/<N>/merge
while it can merge the pull request into its base branch, so one that conflicts,
or one already closed, has only refs/pull/<N>/head. That is still something to
test - the pull request on its own rather than as it would land - so it is used,
with a warning saying which ref was tested and what the head ref does not have.
Nothing at all for that number remains an error.

And a parameter that is not there yet. A job only records a parameter once a
build has run with its definition, so the build that first sees a changed
Jenkinsfile has the new ones as null - and every build evaluates the when
of the pull request stages, not only one asking for a pull request. They now fall
back to what the definition says the default is.

Tested

git ls-remote against the three cases, with the branch of the case each one
takes:

number refs on GitHub
16420 (open) head and merge Testing refs/pull/16420/merge
16357 (merged) head only warns, Testing refs/pull/16357/head
16360 (an issue) none says there is no such pull request, exits 1

Generated by Claude Code.

…penModelica#307)

Asking the job for 16360 spent minutes cloning and resetting the
OpenModelica repository before failing with "Could not fetch
refs/pull/16360/merge: either there is no such pull request, or GitHub
cannot merge it into its base branch". Both of those were wrong about what
had happened: 16360 is an *issue*. Issues and pull requests share one
numbering on GitHub, so an issue number reaches the job looking exactly
like a pull request number, and the answer to that is "there is no such
pull request", which the message buried as one of two possibilities.

The stage now asks GitHub what the number is - one git ls-remote, before
the clone, the reset and the build - and says so:

  OpenModelica/OpenModelica has no pull request 16360. Issues and pull
  requests share one numbering there, so check that 16360 is not the
  number of an issue.

The checkout separates the two cases as well. GitHub only has
refs/pull/<N>/merge while it can merge the pull request into its base
branch, so a pull request that conflicts, or one already closed, has only
refs/pull/<N>/head. That is still something to test - the pull request on
its own rather than as it would land - so it is used, with a warning
saying which of the two was tested and what the head ref does not have.
Nothing at all for that number is still an error.

While here: a parameter is only recorded on a job once a build has run
with its definition, so the build that first sees this file has the new
ones as null, and every stage that reads them to decide whether to run
would fail on it, not only a pull request one. They now fall back to what
the definition says the default is.

---
Generated by Claude Code.
@adrpo
adrpo force-pushed the fix-pull-request-checkout branch from c20919a to 49eeb1e Compare August 24, 2026 16:14
@adrpo
adrpo merged commit 8cd8f57 into OpenModelica:master Aug 24, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant